#ifndef SENDFILEWIDGET_H
#define SENDFILEWIDGET_H

#include <QDialog>
#include <QPushButton>
#include <QVBoxLayout>
#include <QFile>
#include <QLabel>
#include <QString>
#include <boost/shared_ptr.hpp>
#include <QHash>

class SingleClient;
class FileTransfer;

class SendFileWidget : public QWidget
{
Q_OBJECT
public:
	explicit SendFileWidget(boost::shared_ptr<SingleClient> client, QWidget *parent = 0);
	boost::shared_ptr<SingleClient> getClient() const
	{
		return m_Client;
	}
	bool isSendSuccess(const QString& filePath) const
	{
		return m_FilePathSet[filePath];
	}
	void setInformation(const QString& information)
	{
		m_InfoLabel->setText(information);
	}

public slots:
	FileTransfer* addFileToSend(const QString& filePath);
signals:
	void finished();
private slots:
	void onCancelAllButton();
	void onSendFinish();
	void onSendCancel();
private:
	void setupWidgets();
	void decreaseActiveCount();
private:
	QVBoxLayout* m_SendFileProgressLayout;
	QLabel* m_InfoLabel;
	QPushButton* m_CancelAllButton;
	boost::shared_ptr<SingleClient> m_Client;
	QHash<QString, bool> m_FilePathSet;
	size_t m_SendCount;
};

#endif // SENDFILEWIDGET_H
